@extends('home.layout')
@section('content')

<div class="dcon">
	<div class="blue50"></div>
	<div class="decon">
		<div class="reblue">
			<div class="falsecon">
				<div class="truecon">
					<div class="moviemenu">
						<div class="movieposter">
							<div class="mpic">
								<a>
									<img src="{{ url($details -> photo) }}" width="270" height="405">
								</a>
							</div><!-- 
							<div class="adderror">
								<a href="#">添加资料</a>
								|
								<a href="">添加图片</a>
								|
								<a href="#">报错</a>
							</div> -->
						</div>
						<div class="movietou">
							<div class="movtitle">
								<strong>{{ $name[0] }}</strong>
								(<a>{{ $details -> time }}</a>)<em id="movie_score">{{ $details -> score }}</em>
								<p>{{ $name[1] }}</p>
								<b>{{ $details -> timelong }}分钟-
									@foreach($type as $type)
									<a>{{ $type }}</a>-
									@endforeach
									
									<a>{{ $details -> time }}</a>{{ $details ->path }}上映
								</b>
							</div>
							<div class="movmenu">
								<a href="{{ url('/home/movie/details') }}/{{ $details -> id }}/plots"><span>剧</span> 情</a>
								<a><span>视</span> 频</a>
								<a href="{{ url('/home/movie/details') }}/{{ $details -> id }}/image"><span>图</span> 片</a>
								<a href="{{ url('/home/movie/details') }}/{{ $details -> id }}/actor"><span>演</span> 员</a>
								<a href="{{ url('/home/movie/details') }}/{{ $details -> id }}/comment"><span>影</span> 评</a>
								<a href="{{ url('/home/movie/details') }}/{{ $details -> id }}/other"><span>其</span> 他</a>
							</div>
							<div class="movgrade">
								<div class="movdata">
									<dl>
										<dd>
											<strong>导演 :</strong>
											<span>{{ $details -> director }}</span>
										</dd>
										<dd>
											<strong>编剧 :</strong>
											@foreach($scriptwriter as $script)
											<span>{{ $script }} &nbsp;&nbsp;</span>
											@endforeach
										</dd>
										<dd>
											<strong>国家地区 :</strong>
											<span>{{ $details -> path }}</span>
										</dd>
										<dd>
											<strong>发行公司 :</strong>
											<span>{{ $details -> publish }}</span>
										</dd>
										<dd>
											<strong>剧情 :</strong>
											<p style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:20em;">
												{{ $details -> synopsis }}
											</p>
											<a href="{{ url('/home/movie/details/') }}/{{ $details -> id }}/plots">更多剧情 <i class="fa fa-angle-double-right"></i></a>
										</dd>
									</dl>
								</div>
								<div class="movrole">
									<dl>
										<dt>主演 :</dt><br />
										@foreach($cast as $cast)
										<dd>
											<img src="/home/images/default.jpg">
											<span>{{ $cast[0] }}</span><br />
											<span>{{ $cast[1] }}</span><br />
											<i>饰{{ $cast[1] }}</i>
										</dd>
										@endforeach
									</dl>
								</div>
							</div>
						</div>
					</div>
					<!-- 电影图片 -->
					<div class="movpiccon">
						<h3>电影图片</h3>
						<dl>

							@foreach($images as $image)
							<dd>
								<img width="213" height="120" src="{{ url($image -> content) }}">
							</dd>
							@endforeach
							
							<dd>
								<a href="{{ url('/home/movie/details') }}/{{ $details -> id }}/image">
									<div>
										查看更多
									</div>
								</a>
							</dd>
						</dl>
					</div>
					<!-- 电影视频 -->
					<!-- <div class="movpiccon">
						<h3>电影视频</h3>
						<dl>
							<dd>
								<img width="100%" src="/home/images/details/3.jpg">
							</dd>
							<dd>
								<img width="100%" src="/home/images/details/3.jpg">
							</dd>
							<dd>
								<img width="100%" src="/home/images/details/3.jpg">
							</dd>
							<dd>
								<img width="100%" src="/home/images/details/3.jpg">
							</dd>
							<dd>
								<a>
									<div>
										查看更多
									</div>
								</a>
							</dd>
						</dl>
					</div> -->
					<!-- 广告位 -->
				    <div class="ad">
				        <div class="adPic">
				            <img width="1000" height="80" src="/home/images/ad/ad1.png">
				        </div>
				    </div>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- 评论 -->
<form method="post" action="{{ url('/home/comment/comment') }}">
	{{ csrf_field() }}

	<input type="hidden" name="pid" value="{{ $details -> id }}">
	<input type="hidden" name="auth" value="0">

	@if(session('user'))
	<input type="hidden" name="uid" value="{{ session('user') -> id }}">
	@endif

	<div class="writecom">
		<div class="bgi">
			<div class="bgimg">
				<div class="bgimage"></div>
			</div>
		</div>
		<div class="writecomcon">
			<div class="usergrade">
				
				@if(!session('user'))
				<a>
					<div class="userdetails">
						<p>
							<img width="60" height="60" src="/home/images/default.png">
						</p>
						<span>匿名</span>
					</div>
				</a>
				@else
				<a>
					<div class="userdetails">
						<p>
							<img width="60" height="60" src="{{ url(session('user') -> photo) }}">
						</p>
						<span>{{ session('user') -> name }}</span>
					</div>
				</a>
				@endif

				<div class="user-g">
					<i>我要评分:</i><br />
					1分<input class="clickLogin" type="radio" name="total" value="1" checked="checked" />
					2分<input class="clickLogin" type="radio" name="total" value="2" />
					3分<input class="clickLogin" type="radio" name="total" value="3" />
					4分<input class="clickLogin" type="radio" name="total" value="4" />
					5分 <input class="clickLogin" type="radio" name="total" value="5" /><br />
					6分<input class="clickLogin" type="radio" name="total" value="6" />
					7分<input class="clickLogin" type="radio" name="total" value="7" />
					8分<input class="clickLogin" type="radio" name="total" value="8" />
					9分<input class="clickLogin" type="radio" name="total" value="9" />
					10分<input class="clickLogin" type="radio" name="total" value="10" />
				</div>
			</div>
			<div class="cline"></div>
			<div class="userwrite">
				<textarea class="clickLogin" name="content" maxlength="600" placeholder="请输入对影评的简短评论,不超过200字"></textarea><br />
				<button>发表</button>
			</div>

			

		</div>
	</div>
</form>
<div style="width:100%;height:10px;background:#127BAB;"></div>
<div class="com_ect">
	<div class="com_ect_con">
		<div class="showcom">
			<span>影评</span>
			<dl class="showfilmcom">

				@foreach($comment as $comments)
				<dd>
					<div>
						<a>
							<img width="48" height="48" src="{{ url($comments -> photo) }}">
						</a>
						<a style="color:#00B1EE;">{{ $comments -> name }}</a>
						<i>{{ $comments -> score }}</i>
						<a style="display:inline-block;color:#00B1EE;margin-top:10px;">{{ $comments -> ctime }}</a>
					</div>
					<div class="showline"></div>
					<div class="usershowcom">
						<p style="font-size:14px;color:#333;">
							{!! $comments -> content !!}
						</p>
						<div class="postlike">
							<a title="赞">
								<i class="pr" pr="{{ $comments -> id }}"></i>
								<b id="counss">{{ $comments -> couns }}</b>
							</a>
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<a title="回复" href="{{ url('/home/movie/details') }}/{{ $comments -> pid }}/comment">
								<em></em> {{ $comments ->  count}}
							</a>
						</div>

						<form method="post" action="{{ url('/home/comment/reply') }}">
						{{ csrf_field() }}

						@if(session('user'))
						<input type="hidden" name="uid" value="{{ session('user') -> id }}">
						@endif

						<input type="hidden" name="pid" value="{{ $comments -> id }}">
						<input type="hidden" name="mid" value="{{ $comments -> pid }}">

						<div class="reply">
							<textarea class="clickLogin" name="content" maxlength="600" placeholder="发表评论,不超过200字"></textarea><br />
							<button>回复</button>
						</div>
						</form>

					</div>
				</dd>
				@endforeach
				

			</dl>
			<div class="morepost">
				<a href="{{ url('/home/movie/details/') }}/{{ $details -> id }}/comment">更多影评</a>
				>>
			</div>
		</div>
		<div class="showect">
			<div>
				<a href="#">
					<img width="300" height="250" src="/home/images/goods/goods2.jpg">
				</a>
			</div>
			<div style="width:300px;height:10px;background:#127BAB;"></div>
		</div>
	</div>
</div>
<!-- 广告位 -->
<div class="ad">
    <div class="adPic">
        <img width="1000" height="80" src="/home/images/ad/ad1.png">
    </div>
</div>

@if(!session('user'))
<script type="text/javascript">
		
	$('.clickLogin').click(function()
		{
			alert('请登录后发表影评');
			window.location.href="/home/reg";
		});

	$.each($('.pr'),function(r,n){
		$(this).click(function()
		{
			var pr = $(this).attr('pr');
			$.ajax({
					url:'/home/comment/couns',
					type:'GET',
					dataType:'json',
					data:'nid=' + pr,
					success:function(data)
					{
						if(data != 'a')
						{
							$(n).next('b').html(data);
							// window.location.reload();
						
						}
					},
					error:function()
					{
						alert('数据异常');
					}	
				});


			
		});
	})

</script>
@endif

@endsection